<?php

class login {
	
	private $login ;
	private $passwd ;
	
	public function __construct()
	{
		$this->db = new myPdo ;
		$req="set names 'UTF8'";
		$this->db->exec($req);
	}
	
	// SETTEURS
	public function setLogin($log)
	{
		$this->login = $log ;
	}
	public function setPasswd($pwd)
	{
		$this->passwd = $pwd ;
	}
	// GETTEURS
	public function getLogin()
	{
		return $this->login ;
	}
	public function getPasswd()
	{
		return $this->passwd ;
	}
	
	// METHODES
	public function verifierLogin($log,$pwd)
	{
		$valide = false ;
		$mdpCrypte = sha1($pwd);
		$r = "SELECT login, passwd FROM login WHERE passwd = '$mdpCrypte' ; " ;

		$resu = $this->db->query($r) ;
		
		if($resu->fetch(PDO::FETCH_OBJ))
		{
			$valide = true ;
		}
		
		return $valide ;
	}
	
}